<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/

Route::group(['domain' => 's.qiyiguo.tv','namespace'=>'Home'], function () {
    Route::get('/robots.txt', function () {
        return <<<ROBOT
User-agent: * 
Disallow: / 
ROBOT;
    });
    Route::post('/','searchController@index');
    Route::get('/','searchController@search')->name('search');
    Route::get('/{key}/{type?}','searchController@index');
    Route::get('/result/{key}/{cat?}','searchController@result');
});


//home
Route::group(['namespace'=>'Home', 'domain' => 'www.qiyiguo.tv','middleware'=>'domainAuth'],function(){
    Route::get('contentLists/{cate_id}','contentController@contentLists')->name('archive.index');
    Route::get('wechat/{archive}.html','contentController@detail')->name('wechat.show');
    Route::get('article/{archive}.html','contentController@detail')->name('article.show');
    Route::get('gallery/{archive}.html','contentController@detail')->name('gallery.show');
    Route::get('video/{archive}.html','contentController@detail')->name('video.show');
    Route::post('archive/follow','contentController@changeFollow');
    Route::any('video','videoController@index')->name('videoLists');
    Route::any('video/cate/{category_id}','videoController@category');
    Route::post('video/more','videoController@more');
    Route::get('/', 'IndexController@index')->name('index');
    Route::get('special/{id}', 'IndexController@special')->name('special');
    Route::any('article','articleController@index')->name('articleLists');
    Route::any('article/cate/{category_id}','articleController@category');
    Route::post('article/more','articleController@more');
    Route::any('qyg/{cate}','qygController@index');
    Route::post('search','searchController@index');
    Route::get('search','searchController@search');
    Route::get('search/{key}/{type?}','searchController@index');
    Route::get('search/result/{key}/{cat?}','searchController@result');
    Route::get('anchor','anchorController@index');
    Route::Post('ajaxGetImages/{archive}','contentController@ajaxGetImages');
    Route::get('about/{cate}','aboutController@about');
});
//mobile
Route::group(['namespace'=>'Home', 'domain' => 'm.qiyiguo.tv','middleware'=>'domainAuth2'],function(){
    Route::get('contentLists/{cate_id}','contentController@contentLists')->name('archive.index');
    Route::get('wechat/{archive}.html','contentController@detail')->name('wechat.show_m');
    Route::get('article/{archive}.html','contentController@detail')->name('article.show_m');
    Route::get('gallery/{archive}.html','contentController@detail')->name('gallery.show_m');
    Route::get('video/{archive}.html','contentController@detail')->name('video.show_m');
    Route::post('archive/follow','contentController@changeFollow');
    Route::any('video','videoController@index');
    Route::any('video/cate/{category_id}','videoController@category');
    Route::post('video/more','videoController@more');
    Route::get('/', 'IndexController@index');
    Route::any('article','articleController@index');
    Route::any('article/cate/{category_id}','articleController@category');
    Route::post('article/more','articleController@more');
    Route::any('qyg/{cate}','qygController@index');
    Route::post('search','searchController@index');
    Route::get('search','searchController@search');
    Route::get('search/{key}/{type?}','searchController@index');
    Route::get('search/result/{key}/{cat?}','searchController@result');
    Route::get('anchor','anchorController@index');
    Route::Post('ajaxGetImages/{archive}','contentController@ajaxGetImages');
    Route::get('about/{cate}','aboutController@about');
});


Route::post('uploadHeadImg','uploadController@uploadHeadImg');
Route::post('uploadWebLogo','uploadController@uploadWebLogo');

Route::post('uploadHeadImg','uploadController@uploadHeadImg');
Route::post('uploadWebLogo','uploadController@uploadWebLogo');
Route::post('uploadBackground','uploadController@uploadBackground');
Route::post('more','uploadController@more');


Route::group(['prefix'=>'auth','namespace'=>'Auth','domain' => 'www.qiyiguo.tv'],function(){
    Route::any('/','loginController@login');
    Route::any('loginMobile','loginController@loginMobile');
    Route::get('startCaptcha/{time}','loginController@startCaptcha');
    Route::post('verifyLogin','loginController@verifyLogin');
    Route::post('quickLogin','loginController@quickLogin');
    Route::get('logout','loginController@logout')->name('logout');
    Route::get('forget','loginController@forgetPassword');
    Route::get('success','loginController@loginSuccess');

    Route::get('weixinWeb', 'loginController@weixinWeb');
    Route::get('wxBind/{id}', 'loginController@wxBind');
    Route::get('weixinWebCallback', 'loginController@weixinWebCallback');

    Route::get('qq', 'loginController@qq');
    Route::get('qqCallback', 'loginController@qqCallback');

    Route::get('weibo', 'loginController@weibo');
    Route::get('weiboCallback', 'loginController@weiboCallback');
    Route::any('bindingPhone','RegisterController@binding');
    //畅言登陆Api
    Route::get('changyan/userinfo','changyanController@userinfo');
    Route::get('changyan/logout','changyanController@logout');

});
Route::group(['prefix'=>'register','namespace'=>'Auth'],function(){
    Route::any('/','RegisterController@reg')->name('reg');
    Route::get('startCaptcha/{time}','RegisterController@startCaptcha');
    Route::post('verifyLogin','RegisterController@verifyLogin');
    Route::post('checkPhone','RegisterController@checkPhone');
    Route::get('success','RegisterController@regSuccess');
    Route::any('bindingPhone','RegisterController@binding');
});
Route::group(['prefix'=>'forget','namespace'=>'Auth'],function(){
    Route::any('/','ForgotPasswordController@forget')->name('forget');
    Route::get('startCaptcha/{time}','ForgotPasswordController@startCaptcha');
    Route::post('verifyLogin','ForgotPasswordController@verifyLogin');
    Route::post('checkPhone','ForgotPasswordController@checkPhone');
    Route::any('setPassword','ForgotPasswordController@setPassword');
    Route::get('success','ForgotPasswordController@resetSuccess');
});
Route::group(['prefix'=>'member','namespace'=>'Member','middleware'=>'loginAuth','domain' => 'www.qiyiguo.tv'],function(){
    Route::get('index','indexController@userIndex')->name('userIndex');
    Route::post('sign','indexController@sign');
    Route::get('masterIndex','indexController@masterIndex')->middleware('masterAuth');
    Route::get('userProfile','userProfileController@index');
    Route::get('userFollow','userFollowController@index');
    Route::get('userFollow_users','userFollowController@users');
    Route::post('userFollow_users','userFollowController@cancelFollowUser');
    Route::get('userFans','userFansController@index');
    Route::get('userCollect','userCollectController@index');
    Route::post('userCollect','userCollectController@cancelCollect');
    Route::post('saveHeadImg','userProfileController@saveHeadImg');
    Route::post('resetPassword','userProfileController@resetPassword');
    Route::post('resetNickname','userProfileController@resetNickname');
    Route::post('resetPhone','userProfileController@resetPhone');
    Route::post('bindingPhone','userProfileController@bindingPhone');
    Route::post('resetIntro','userProfileController@resetIntro');
    Route::resource('userManage','userManageController');
    Route::post('saveNickname','userManageController@saveNickname')->middleware('userManageAuth');
    Route::post('savePhonePassword','userManageController@savePhonePassword')->middleware('userManageAuth');
    Route::post('saveAuth','userManageController@saveAuth')->middleware('userManageAuth');
    Route::get('masterPowers','powersController@index')->middleware('powersAuth');
    Route::post('addMaster','powersController@addMaster')->middleware('powersAuth');
    Route::post('masterPowerEdit','powersController@masterPowerEdit')->middleware('powersAuth');
    Route::post('delMaster','powersController@delMaster')->middleware('powersAuth');
    Route::get('masterGlobal','masterGlobalController@index')->middleware('globalAuth');
    Route::post('masterGlobal','masterGlobalController@index')->middleware('globalAuth');
    Route::get('masterCategory','categoryController@index')->middleware('catAuth');
    Route::post('masterCategory','categoryController@store')->middleware('catAuth');
    Route::get('masterCategoryAdd','categoryController@create')->middleware('catAuth');
    Route::get('masterCategoryDel/{id}','categoryController@delete')->middleware('catAuth');
    Route::get('masterCategory/{id}','categoryController@edit')->middleware('catAuth');
    Route::post('masterCategory/{id}','categoryController@update')->middleware('catAuth');
    Route::post('category/is_on','categoryController@is_on')->middleware('catAuth');
    Route::resource('links','linksController');
    Route::post('links/status','linksController@status');
    Route::any('message','messageController@index');
    Route::any('message/nopass','messageController@nopass');
    Route::post('message/change','messageController@change');
    Route::post('message/destroy','messageController@destroy');
    Route::get('message/more/{page}','messageController@more');
    Route::get('search','indexController@search')->middleware('masterAuth');
    Route::get('search_del/{id?}','indexController@search_del')->middleware('masterAuth');
});
Route::get('noAuth',function(){
   return view('member.noAuth');
});

Route::group(['prefix'=>'auth','namespace'=>'Auth','domain' => 's.qiyiguo.tv'],function(){
    Route::any('/','loginController@login');
    Route::any('loginMobile','loginController@loginMobile');
    Route::get('startCaptcha/{time}','loginController@startCaptcha');
    Route::post('verifyLogin','loginController@verifyLogin');
    Route::post('quickLogin','loginController@quickLogin');
});

require dirname(__FILE__).'/api.php';
require dirname(__FILE__).'/anchor.php';
require dirname(__FILE__).'/tag.php';